import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 玩具
 * User: DELL
 * Date: 2024-05-03
 * Time: 17:21
 */
public class Main3 {
    /**
     * 本题初步猜测是先排序，排完序后依次拿一个大数和小数进行组合
     * -----------------------------------------------------------
     * 其实本题目仔细想想也确实是这样，比如目前有四个正整数
     * a < b < c < d
     * 那么 ac + bd 的组合一定大于 ad + bc
     * 因为 (ac + bd) - (ad + bc) = (bd - ad) + (ac - bc) = (b-a)d + (a-b)c = (b-a)(d-c) > 0
     * 即得证
     *
     * @param args
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[2 * n];
        for (int i = 0; i < 2 * n; i++) {
            arr[i] = scanner.nextInt();
        }
        Arrays.sort(arr);
        long res = 0;
        for (int i = 0; i < n; i++) {
            res += (long) arr[i] * arr[2 * n - i - 1];
        }
        System.out.println(res);
    }
}
